package org.zhucy.design.singleton;

/**
 * 双层检测锁
 * @Auther: zhuchunyang
 * @Date: 2019/6/25 11:51
 * @Description:
 */
public class My4Singleton {

    private volatile My4Singleton singleton;

    private My4Singleton(){}

    public  My4Singleton getInstance() {
        if(singleton==null){
            synchronized (My4Singleton.class){
                if(singleton==null) {
                    singleton = new My4Singleton();
                }
            }
        }
        return singleton;
    }
}
